# -*- coding: utf-8 -*-
# @Time    : 2020/1/13 21:58
# @Author  : Weymouth
# @Email   : 261229090@qq.com
# @File    : function.py
# @Software: PyCharm
# ---------------------------------------------------

#函数 != function()
#计算机函数 == subroutine 子程序, procedures 过程
#作用：
# 1.减少重复代码;
# 2.方便修改，更易扩展
# 3.保持代码的一致性

# def f():
#     print('ok')
#
# f() #调用一定记得加括号

# def add(x, y):
#     print(x + y)
#
#
# add(3, 5)

import time

def logger(n):
    time_format = '%Y-%m-%d %X'
    time_current = time.strftime(time_format)

    with open('日志记录', 'a') as f:
        f.write('%s end action%s\n' % (time_current, n))

def action1(n):
    print('starting action1......')
    logger(n)

def action2(n):
    print('starting action2......')
    logger(n)

action1(11)
action2(22)